package com.xhq.wms.dao.system;

import com.xhq.commons.dao.impl.BaseDaoImpl;
import com.xhq.commons.dto.Pageable;
import com.xhq.wms.entity.system.Plan;

public class PlanDao extends BaseDaoImpl<Plan> {
   public Pageable<Plan> findPage(Integer offset,Integer limit){
       String listSql=" select id,ownerid,ownername,providename,linkname,handername,status  from plan where deleted=0 ";
       String countSql=" SELECT COUNT(*) from plan where deleted =0 ";
       Pageable<Plan> pageable = super.queryPage(listSql, countSql, offset, limit);
       return pageable;
   }

   public void save(Plan plan){
       String sql=" insert into plan (ownerid,ownername,providename,linkname,handername,status) values (?,?,?,?,?,1) ";
       super.cud(sql,plan.getOwnerid(),plan.getOwnername(),plan.getProvidename(),plan.getLinkname(),plan.getHandername());
   }

   public void delete(Integer id){
       String sql=" update plan set deleted=1 where id=? ";
       super.cud(sql,id);
   }

   public Plan find(Integer id){
       String sql =" select * from plan where id =? ";
       Plan plan = super.queryOne(sql, id);
       return plan;
   }
}
